package cn.touna.jss.common.exception;

import cn.touna.jss.common.factory.ResponseFactory;
import cn.touna.risk.api.domain.Response;
import cn.touna.risk.api.enums.SystemErrorCodeEnum;

public class ResponseException extends Exception {

    public ResponseException(){
        super();
    }

    public ResponseException(Response response){
        super(response.getMsg());
        this.response = response;
    }

    private Response response;

    public Response getResponse() {
        return response;
    }

    public void setResponse(Response response) {
        this.response = response;
    }

    public static ResponseException build(SystemErrorCodeEnum codeEnum, String msg){
        return new ResponseException(ResponseFactory.fail(codeEnum,msg));
    }
}
